package main

import "fmt"

type SayHello interface {
	say()
	eat()
}

// Chinese 结构体中国人
type Chinese struct {
	Name string
}

// America 结构体美国人
type America struct {
	Name string
}

func (c *Chinese) say() {
	fmt.Println("你好", c.Name)
}
func (c *Chinese) eat() {
	fmt.Println("Chinese eat")
}
func (a *America) say() {
	fmt.Println("hello", a.Name)
}
func (a *America) eat() {
	fmt.Println("America eat")
}

func great(say SayHello) {
	say.say()
}
func main() {
	a := America{"rose"}
	c := Chinese{"小明"}
	var arr [2]SayHello = [2]SayHello{&a, &c}
	fmt.Println(arr)
	for i, hello := range arr {
		fmt.Println(i, hello)
	}
	great(&a)
	great(&c)
}
